from bs4 import BeautifulSoup


class RunoobPipeline:

    def process_item(self, item, spider):
        # item['name'] = item['name'].replace('/', ' ')
        if item['name'] is not None:
            path = '../../rawHTML/' + item['name'] + '.txt'
            bs = BeautifulSoup(item['content'], 'html.parser')
            with open(path, "w+") as f:
                f.write(bs.prettify())
                f.close()
        return
